﻿using System;
using System.Windows.Data;
using System.Globalization;

namespace MoonyDesk.Converters
{
    [ValueConversion(typeof(double), typeof(int))]
    public class DoubleToIntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (int)Math.Round((double)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (int)Math.Round((double)value);
        }
    }
}
